home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / aprs403x.zip / MAPCNVRT.BAS < prev    next >
BASIC Source File  |  1993-08-23  |  3KB  |  74 lines

  1. REM this program takes a map file and then can output another map file
  2. REM to a different ppdV and ppdH and different origin.
  3. REM then the beginning stuff and all labels at the end must be cut
  4. REM and pasted back into the new file
  5.  
  6. OPTION BASE 0
  7. CLS : PRINT "This program will convert any APRS map from one ORIGIN and SCALE"
  8.       PRINT "to another.  The output of this program will be in MAPTEMP.map"
  9.       PRINT
  10. Prompt: INPUT "Enter File name of source map"; F$
  11.         OPEN F$ FOR INPUT AS #3
  12.         INPUT "Enter desired SCALE in pixels-per-deg"; PPDD
  13.         INPUT "Enter New Latitude of origin"; NLat
  14.         INPUT "Enter New Longitude of origin"; NLon
  15. LoadAux: 'Load into another dim of array until full (AyPtr starts at 0)
  16.      INPUT "Enter file name for output if other than MAPTEMP.MAP"; F$
  17.      IF F$ = "" THEN F$ = "MAPTEMP.MAP"
  18.      OPEN F$ FOR OUTPUT AS #4
  19.      INPUT #3, LATa: LINE INPUT #3, a$: IF NLat = 0 THEN NLat = LATa
  20.      PRINT #4, NLat; ","; a$
  21.      INPUT #3, LONa: LINE INPUT #3, a$: IF NLon = 0 THEN NLon = LONa
  22.      PRINT #4, NLon; ","; a$
  23.      INPUT #3, ppdV: LINE INPUT #3, a$'Pix-per-deg-Vert
  24.      PRINT #4, PPDD; ","; a$
  25.      INPUT #3, LatCen: LINE INPUT #3, a$
  26.      PRINT #4, LatCen; ","; a$
  27.      INPUT #3, LonCen: LINE INPUT #3, a$
  28.      PRINT #4, LonCen; ","; a$
  29.      INPUT #3, MapRng: LINE INPUT #3, a$
  30.      PRINT #4, MapRng; ","; a$
  31.      INPUT #3, MinRnga: LINE INPUT #3, a$
  32.      PRINT #4, MinRnga; ","; a$
  33.      LINE INPUT #3, a$: REM ignore line of instructions
  34.      PRINT #4, a$
  35.      i = 0
  36.      REM now make offset and scale calculations
  37.      Sfac = PPDD / ppdV
  38.      LOfset = LONa - NLon
  39.      LAfset = LATa - NLat
  40. ON ERROR GOTO Errorfix
  41.  
  42.      PRINT : PRINT "Now processing map points.  Should an end of file error occur"
  43.      PRINT "use F6, then CLOSE, to close the file.  Then use your editor to see"
  44.      PRINT "what you have so far and fix any errors..."
  45.  
  46.      DO WHILE NOT EOF(3)
  47.         i = i + 1: INPUT #3, x%, y%
  48.         IF x% <> 0 THEN
  49.            x% = Sfac * (x% - ppdV * LOfset)
  50.            y% = Sfac * (y% - ppdV * LAfset)
  51.            IF x% = 0 THEN x% = 1: PRINT "ZERO value of X!  Converted to 1,"; y%
  52.            END IF
  53.         REM print #4, MID$(STR$(x%), 2); ","; MID$(STR$(y%), 2)
  54.         WRITE #4, x%, y%
  55.         IF x% = 0 AND NOT EOF(3) THEN ' Get line color & store with x=0
  56.            INPUT #3, z%: LINE INPUT #3, a$ ' Echo line name
  57.            PRINT #4, z%; ","; a$
  58.            IF y% = -1 THEN EXIT DO' All labels listed at end of file
  59.            END IF
  60.         LOOP: PRINT
  61.         PRINT "All map points converted.  Now doing labels..."
  62.         DO WHILE NOT EOF(3)
  63.         LINE INPUT #3, a$: PRINT #4, a$
  64.         LOOP: CLOSE #3: CLOSE #4
  65.        
  66.         PRINT : PRINT "CONVERSION SUCCESSFUL. USE EDITOR TO ADD ANY NEW FEATURES"
  67.         PRINT "TO YOUR NEW MAP IN FILE NAMED MAPTEMP.map."
  68.         INPUT "Hit return to continue.."; a$: STOP
  69.  
  70. Errorfix: IF ERR = 62 THEN CLOSE : RESUME NEXT
  71.  
  72. END
  73.  
  74.